package com.xuetang9.t9.hotel.services.impl;

import com.xuetang9.t9.hotel.beans.Floor;
import com.xuetang9.t9.hotel.mapper.IFloorMapper;
import com.xuetang9.t9.hotel.services.IFloorService;
import com.xuetang9.t9.hotel.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.ParameterResolutionDelegate;
import org.springframework.stereotype.Service;

/**
 * 楼层服务层
 */
@Service
public class FloorServiceImpl implements IFloorService {
    @Autowired
    private IFloorMapper floorMapper;

    @Override
    public boolean save(Floor floor) {
        return floorMapper.insert(floor) > 0;
    }

    @Override
    public boolean remove(Integer id) {
        return floorMapper.delete(id) > 0;
    }

    @Override
    public boolean alter(Floor floor) {
        return floorMapper.update(floor) > 0;
    }

    @Override
    public ResponseResult findByAll() {
        return ResponseResult.okResult(floorMapper.selectByAll());
    }

    @Override
    public Floor findById(Integer id) {
        return floorMapper.selectById(id);
    }

    @Override
    public ResponseResult findByFloorAll() {
        return ResponseResult.okResult(floorMapper.selectByFloorAll());
    }
}
